/*
 * Dimension.cpp
 *
 *  Created on: 23-11-2010
 *      Author: Przemek
 */

#include "geometry/Dimension.hpp"

Dimension::Dimension(int width, int height) :
	size(width, height)
{
}

Dimension::Dimension(float width, float height) :
	size(width, height)
{
}

Dimension::Dimension(const Dimension& other) :
	size(other.size)
{
}

float Dimension::getWidth() const
{
	return size.getX();
}

void Dimension::setWidth(int width)
{
	size.setX(width);
}

void Dimension::setWidth(float width)
{
	size.setX(width);
}

float Dimension::getHeight() const
{
	return size.getY();
}

void Dimension::setHeight(int height)
{
	size.setY(height);
}

void Dimension::setHeight(float height)
{
	size.setY(height);
}

const Vector& Dimension::toVector() const
{
	return size;
}

Dimension Dimension::operator+(const Dimension& other) const
{
	const Vector newSize = size + other.toVector();
	return Dimension(newSize.getX(), newSize.getY());
}

Dimension Dimension::operator-(const Dimension& other) const
{
	return operator+(-other);
}

Dimension& Dimension::operator=(const Dimension& other)
{
	if(this != &other)
	{
		size = other.size;
	}
	return *this;
}

bool Dimension::operator==(const Dimension& other) const
{
	return (size == other.size);
}
bool Dimension::operator!=(const Dimension& other) const
{
	return !(operator==(other));
}

Dimension Dimension::operator-() const
{
	return Dimension(-size.getX(), -size.getY());
}
